<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
	
	class Unit_model extends CI_Model {
		public function ___construct(){
			parent::__construct();
		$data=array();
	
		}
	
	
	
	public function insert($name,$description,$remarks,$entryby,$additional_data){
		$data= array(
		'name' => $name,
		'description' => $description,
		'remarks' => $remarks,
		'entryby' => $entryby
		);
		$this->db->insert('unit_table',$data);
	}
	public function get_unit(){	
		$query = $this->db->get('unit_table');
		return $query;
	}
	public function edit_unit($id){
		
		$query = $this->db->get_where('unit_table', array('id' => $id));
		
		return $query;
	}
	public function update($edit_id, $data){
		$this->db->update('unit_table',$data,array('id'=>$edit_id));
	}
	public function delete($id){
		$this->db->delete('unit_table',array('id'=>$id));		
	}
	public function get(){
		$this->datatables
			->select("id,name,description,remarks,entryby")
			->from("unit_table")		
			->add_column("Actions", 
			"<center>			<a href='edit_unit/$1'>
								<i class='icon-edit'></i>
								</a>
							    <a href='delete_unit/$1' onClick=\"return confirm('". 'Do U Want To Delete Category! ' ."')\">
								<i class='icon-trash'></i>
								</a></center>", "id")
			->unset_column('id');
		
	   return  $this->datatables->generate();
	
	}
}
?>